package cn.com.blueInfo.bpm.template.convert;

import cn.com.blueInfo.bpm.common.convert.BaseConvert;
import cn.com.blueInfo.bpm.template.entity.AutomationRule;
import cn.com.blueInfo.bpm.template.request.AutomationRuleDTO;
import cn.com.blueInfo.bpm.template.response.AutomationRuleVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 自动化规则表 对象转换
 * @author suxch
 * @since 2025-08-31 16:23:18
 */
@Mapper(componentModel = "spring")
public interface AutomationRuleConvert
        extends BaseConvert<AutomationRule, AutomationRuleDTO, AutomationRuleVO> {

    AutomationRule dtoToEntity(AutomationRuleDTO dto);

    AutomationRule dtoToEntity(AutomationRuleDTO.UpdatePartialDTO dto);

    @Mapping(source = "status", target = "status", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleted", target = "deleted", qualifiedByName = "enumToDesc")
    @Mapping(source = "executionType", target = "executionType", qualifiedByName = "enumToDesc")
    AutomationRuleVO entityToVO(AutomationRule entity);

}